import request from "@/utils/request.js"

// 查询所有课程分类数据
export const selectAllApi = ({ pageNum, pageSize }) => {
  return request.get("/courseCategory/selectAll", {
    params: { pageNum, pageSize }, // 使用 params 传递查询参数
  });
};

//根据名称模糊查询数据
export const selectByNameApi = ({ name, pageNum, pageSize }) => {
  return request.get("/courseCategory/selectByName", {
    params: { name, pageNum, pageSize },
  })
}

//批量删除
export const deleteGroupApi = (groupIds) => {
  return request.delete("/courseCategory/deleteGroup", {
    data: { groupIds } // 发送 JSON 格式的请求体
  });
};

//单个删除
export const deleteApi = ( id ) => {
  return request.delete('/courseCategory/delete', {
    params: { id },
  })
}

//增加数据
export const insertApi = (data)=>{
  console.log(data)
  return request.post("/courseCategory/insert", data)
}

//更新数据
export const updateApi = ( data ) => {
  console.log(data)
  return request.post("/courseCategory/update", data)
}
